﻿using System.Collections.Generic;
using Weibo4Sharp.Model;
using Hammock.Web;

namespace Weibo4Sharp.Service
{
    public partial class WeiboService
    {
        public virtual WeiboUser BlockUser(long userId)
        {
            return WithHammock<WeiboUser>(WebMethod.Post, "blocks/create", FormatAsString, "?user_id=", userId);
        }

        public virtual WeiboUser BlockUser(string userScreenName)
        {
            return WithHammock<WeiboUser>(WebMethod.Post, "blocks/create", FormatAsString, "?screen_name=", userScreenName);
        }

        public virtual WeiboUser UnblockUser(long userId)
        {
            return WithHammock<WeiboUser>(WebMethod.Delete, "blocks/destroy", FormatAsString, "?user_id=", userId);
        }

        public virtual WeiboUser UnblockUser(string userScreenName)
        {
            return WithHammock<WeiboUser>(WebMethod.Delete, "blocks/destroy", FormatAsString, "?screen_name=", userScreenName);
        }

        public virtual WeiboResult VerifyBlocking(long userId)
        {
            return WithHammock<WeiboResult>("blocks/exists", FormatAsString, "?user_id=", userId);
        }

        public virtual WeiboUser VerifyBlocking(string userScreenName)
        {
            return WithHammock<WeiboUser>("blocks/exists", FormatAsString, "?screen_name=", userScreenName);
        }

        public virtual IEnumerable<WeiboUser> ListBlockedUsers()
        {
            return WithHammock<IEnumerable<WeiboUser>>("blocks/blocking", FormatAsString);
        }

        public virtual IEnumerable<WeiboUser> ListBlockedUsers(int count = 20, int page = 1)
        {
            return WithHammock<IEnumerable<WeiboUser>>("blocks/blocking", FormatAsString,
                "?count=", count,
                "&page=", page);
        }

        public virtual IEnumerable<long> ListBlockedUserIds()
        {
            return WithHammock<IEnumerable<long>>("blocks/blocking/ids", FormatAsString);
        }
    }
}
